/**
 * Copyright &copy; 2012-2017 <a href="https://vivo.com">vivo</a> All rights reserved.
 */
package com.vivo.dealer.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.vivo.dealer.entity.VivoWarehouse;
import com.vivo.dealer.dao.VivoWarehouseDao;

/**
 * 仓库Service
 * @author jyangye
 * @version 2017-11-07
 */
@Service
@Transactional(readOnly = true)
public class VivoWarehouseService extends CrudService<VivoWarehouseDao, VivoWarehouse> {

    @Autowired
    private VivoWarehouseDao vivoWarehouseDao;

    public VivoWarehouse getLastItem(VivoWarehouse vivoWarehouse) {
        List<VivoWarehouse> list = vivoWarehouseDao.getLastItem(vivoWarehouse);
        if (list.size() > 0) {
            return list.get(0);
        }

        return null;
    }

	public VivoWarehouse get(String id) {
		return super.get(id);
	}

	public VivoWarehouse get(VivoWarehouse vivoWarehouse) {
		return super.get(vivoWarehouse);
	}

	public List<VivoWarehouse> findList(VivoWarehouse vivoWarehouse) {
		return super.findList(vivoWarehouse);
	}
	
	public Page<VivoWarehouse> findPage(Page<VivoWarehouse> page, VivoWarehouse vivoWarehouse) {
		return super.findPage(page, vivoWarehouse);
	}

    @Transactional(readOnly = false)
    public void deleteAll(VivoWarehouse vivoWarehouse) {
        vivoWarehouseDao.deleteAll(vivoWarehouse);
    }

	@Transactional(readOnly = false)
	public void insertByBatch(List<VivoWarehouse> list, String area) {
        if (area.equals("ah")) {
            vivoWarehouseDao.insertByBatchAh(list);
        } else {
            vivoWarehouseDao.insertByBatchJs(list);
        }
    }
	
	@Transactional(readOnly = false)
	public void save(VivoWarehouse vivoWarehouse) {
		super.save(vivoWarehouse);
	}
	
	@Transactional(readOnly = false)
	public void delete(VivoWarehouse vivoWarehouse) {
		super.delete(vivoWarehouse);
	}

	
}